Correct the handling of display names.
authorMatthias Clasen <matthiasc@src.gnome.org>
Wed, 30 May 2007 05:56:32 +0000 (05:56 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 30 May 2007 05:56:32 +0000 (05:56 +0000)
svn path=/trunk/; revision=17982

ChangeLog
gtk/gtkiconcachevalidator.c

index 127219a57b720aa0cf6a465613fb8fd713496d89..9a3838cc9f8fc438169b8bb711896bf30753cbbf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-30  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkiconcachevalidator.c: Correct the handling
+       of display names.  (#441767, Marcin Bachry)
+
 2007-05-30  Xan Lopez  <xan@gnome.org>
 
        * gtk/gtknotebook.c (gtk_notebook_set_current_page): Small cleanup.
        (cups_printer_get_capabilities): Add a new print capability to specify
        whether print dialog will offer printing multiple pages per sheet. (#398414)
        
+2007-05-28  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtktoolbar.h: Actually undeprecate 
+       gtk_toolbar_[un]set_icon_size.  (#314172. Yevgen Muntyan)
+
 2007-05-28  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkwidget.c: Document some more signals
index 21c4ec205995729a5decadef400bcc958ffe6e47..73cf351118167b6b4ea5e9e37c9d61c3b66e9bc6 100644 (file)
@@ -103,6 +103,32 @@ check_string (CacheInfo *info,
   return TRUE;
 }
 
+static gboolean 
+check_string_utf8 (CacheInfo *info, 
+                   guint32    offset)
+{
+  check ("string offset", offset < info->cache_size);
+
+  if (info->flags & CHECK_STRINGS) 
+    {
+      gint i;
+      gchar c;
+
+      /* assume no string is longer than 1k */
+      for (i = 0; i < 1024; i++) 
+        { 
+          check ("string offset", offset + i < info->cache_size)
+            c = *(info->cache + offset + i);
+          if (c == '\0')
+            break;
+        }
+      check ("string length", i < 1024);
+      check ("string utf8 data", g_utf8_validate((char *)(info->cache + offset), -1, NULL));
+    }
+
+  return TRUE;
+}
+
 static gboolean 
 check_directory_list (CacheInfo *info, 
                       guint32    offset)
@@ -172,16 +198,18 @@ static gboolean
 check_display_name_list (CacheInfo *info, 
                          guint32    offset)
 {
-  guint32 n_display_names;
+  guint32 n_display_names, ofs;
   gint i;
 
   check ("offset, display name list", 
          get_uint32 (info, offset, &n_display_names));
   for (i = 0; i < n_display_names; i++) 
     {
-      if (!check_string (info, offset + 4 + 8 * i))
+      get_uint32(info, offset + 4 + 8 * i, &ofs);
+      if (!check_string (info, ofs))
         return FALSE;
-      if (!check_string (info, offset + 4 + 8 * i + 4))
+      get_uint32(info, offset + 4 + 8 * i + 4, &ofs);
+      if (!check_string_utf8 (info, ofs))
         return FALSE;
     }